function Food(el){
    this.el = el
    this.len = 20
    this.divObj = null
    this.foodX=0
    this.foodY=0
    this.init()
}
Food.prototype.init = function(){
    let divobj = document.createElement('div')
    divobj.style.width = this.len + 'px'
    divobj.style.height = this.len + 'px'
    divobj.style.background = 'green'
    divobj.style.position = 'absolute'
    this.divobj = divobj
    this.el.appendChild(divobj)
    this.move()
}
Food.prototype.move = function(){
    let foodXMaxNum = this.el.clientWidth / this.len - 1
    let foodYMaxNum = this.el.clientHeight / this.len - 1
    this.foodX = Math.floor(Math.random() * (foodXMaxNum-0+1)+0) * this.len
    this.foodY = Math.floor(Math.random() * (foodYMaxNum-0+1)+0) * this.len
    this.divobj.style.left = this.foodX + 'px'
    this.divobj.style.top = this.foodY + 'px'
}
